Author

Email validation function using JavaScript

A Javascript function to check email validation. Returns boolean. function ValidateEmail(email) { var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/; if (!reg.test(email)) return false; return true; } Happy Coding! Related Snippets

Compute the Product of Two Matrices Using C

Below is a C program which takes two matrix form users to multiply them and print the results on the screen. Product of Two Matrices Using C Here is the source code of the program in C to Compute the Product of Two Matrices. This program is successfully compiled, and the output is also given... » read more

Select a Random Item from an Array using JavaScript

The snippet below selects a random item from an array and show it in an alert box using Javascript. <script> var arr = [ "ASP.NET", "C", "C++", "C#", "Java", "JavaScript", "MVC CORE", "VB.NET" ]; var random = arr[Math.floor(Math.random()*arr.length)]; alert(random) </script> Happy Coding! Related Snippets

Find Factorial of a Number using Recursion in C++

First of all, we need to understand the concept of recursion and factorial to write this program. What is Recursion? It is an essential concept in computer science. In computer science, recursion is a process in which a function calls itself directly or indirectly. Recursion function must have the following two properties: What is Factorial?... » read more

Get local IP Address using C

Here is the source code of the program in C to get the local IP address. This program is successfully compiled, and the output is also given below. C program to get local IP Address #include<stdlib.h> #include<hostname> #include <stdio.h> struct hostent *he_bool; struct in_addr a; int main (int argc) { char *hostname = malloc (MAXHOSTNAMELEN);... » read more

Check if a given String is Palindrome using C

A string is said to be palindrome if it remains unchanged after reversing it.  For Example 4646, aeoaeo, mom, dad, and nana are some examples of palindrome strings. Below is the source code of the program in C to check if a given string is Palindrome. This program is successfully compiled, and the output is... » read more

Convert Roman Number to Decimal Number Using C

Below is a C program which takes a roman number form the user and convert it into a decimal number. We need to understand what the roman number is. What are Roman Numbers? The Roman numbers are represented by the combination of letter from Latin alphabets. It is a numeric system that was devised in... » read more

How to Check if a Matrix is Invertible using C++

To write this program, we need to understand the concept of invertible. A matrix (A)n ×n is said to be invertible if and only if there exists another matrix (B)n ×n such that AB=BA=ln. A matrix is invertible if and only if its determinant is not zero. A matrix is singular or not invertible if... » read more

Convert Hexadecimal to Binary using C

Below is a c program which takes a hexadecimal number as an input and converts it into a binary number. Convert Hexadecimal to Binary in C Here is the source code of the program in C to Convert Hexadecimal number to Binary number. This program is successfully compiled, and the output is also given below.... » read more

Simulate a ‘N’ Roller Dice using C++

A dice roller grants you to roll a constructive dice. It is used to generate a sequence of random number mainly use in gambling games like Backgammon, sic bo or Yahtzee. A computational device uses to create a series of random symbols or numbers with lack of any pattern. How to simulate a Roller Dice... » read more

An encoding of a message using matrix multiplication in C++

Encoding is performed between a given matrix and key matrix using matrix multiplication. We included header file conio.h to use getch() function which is used to stop the output screen from blinking. Message encoding using matrix multiplication in C++ Below is a C++ program that an encoding of a message using matrix Multiplication. This program... » read more

Perform Matrix Multiplication using C++

Below is a C++ program to perform Matrix Multiplication. This program is successfully compiled, and the output is also given below. Matrix Multiplication in C++ #include<iostream> using namespace std; int main () { int row1, clum1, row2, clum2; int i, j, k; int X[8][8], Y[8][8], Z[8][8]; cout << "Please Enter Rows and Columns Of Mateix... » read more

How to Convert Binary to Octal in C

This program will accept input from the user as a binary number and convert that number into an octal number. To correctly understand this program, you should be familiar with the while loop concept. Convert Binary to Octal using C Here is the program source code to convert the binary number into octal. This program... » read more

How to Swap Two Numbers using C#

Swapping of two numbers refers to the exchanging values of two variables. Here are two methods which we can use for swapping two integers Swap using a temporary variable Swap without using a temporary variable Swap two integer using a temporary variable This swap operation is performed by using a third variable (a temporary variable). Here... » read more